package com.evry.repository;

import javax.sql.DataSource;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.jdbc.core.support.JdbcDaoSupport;

/**
 * Abstract class for cost common functions which are used for all daos.
 * 
 * @author eu2421
 *
 */
public abstract class AbstractDaoSupport extends JdbcDaoSupport {

    private NamedParameterJdbcTemplate namedParameterJdbcTemplate;
    
    @Autowired
    public AbstractDaoSupport(DataSource dataSource){
        setDataSource(dataSource);
        this.namedParameterJdbcTemplate = new NamedParameterJdbcTemplate(dataSource);
    }
    
    /**
     * @return the namedParameterJdbcTemplate
     */
    public NamedParameterJdbcTemplate getNamedParameterJdbcTemplate() {
        return namedParameterJdbcTemplate;
    }
}
